package com.daniel.oop.demo05;

/**
 * 子类继承了父类，就会拥有父类的全部方法
 *
 * @author Daniel
 * @version V1.0
 * @date 2020/5/12 15:04
 */
public class Student extends Person {

	private String name = "wsp";

	public Student() {
		// 隐藏代码：调用了父类的无参构造
		// 调用父类的构造器，必须在子类代码的第一行
		super();
		System.out.println("Student无参执行了");
	}

	@Override
	public void print() {
		System.out.println("Student");
	}

	public void test(String name) {
		System.out.println(name);
		System.out.println(this.name);
		System.out.println(super.name);
	}

	public void test1() {
		print();
		this.print();
		super.print();
	}
}
/*
Student student = new Student();
student.test("吴");
student.test1();
 */
